package admincow.servlet.raza;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admincow.dao.RazaDAO;
import admincow.vo.RazaVO;

/**
 * Servlet implementation class for Servlet: RazaNuevoServlet
 *
 */
 public class RazaNuevoServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public RazaNuevoServlet() {
		super();
	}   	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}  	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		RazaDAO dao = new RazaDAO();
		RazaVO vo = new RazaVO();
		vo.setNombre(request.getParameter("nombre"));
		vo.setDescripcion(request.getParameter("descripcion"));
		dao.insertar(vo);
		request.getRequestDispatcher("/razaBuscar.jsp").forward(request,
				response);
	}   	  	    
}